/*
 *Copyright (c) 2024 Black Sesame Technologies
 *
 *Licensed under the Apache License, Version 2.0 (the "License");
 *you may not use this file except in compliance with the License.
 *You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 *Unless required by applicable law or agreed to in writing, software
 *distributed under the License is distributed on an "AS IS" BASIS,
 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *See the License for the specific language governing permissions and
 *limitations under the License.
*/


#ifndef _WDT_H
#define _WDT_H
#include "../../common/r5_lsp_crm_func.h"

#define  WDT_CR      		0x0      
#define  WDT_TORR    		0x4   
#define  WDT_CCVR    		0x8   
#define  WDT_CRR     		0xC  
#define  WDT_STAT    		0x10      
#define  WDT_EOI     		0x14      
#define  WDT_PROT_LEVEL  	0x1C  
#define  WDT_COMP_PARAM_5	0XE4
#define  WDT_COMP_PARAM_4  	0XE8
#define  WDT_COMP_PARAM_3   0XEC
#define  WDT_COMP_PARAM_2   0XF0
#define  WDT_COMP_PARAM_1   0XF4
#define  WDT_COMP_VERSI     0XF8
#define  WDT_COMP_TYPE      0XFC

#define WDT_KICK_MAGIC   	0X76

typedef enum{
 	WDT_RMODE_RESET = 0,
	WDT_RMODE_INTR
}WDT_RMODE_E;

typedef enum{
	WDT_RPL_2_CYCLES = 0,
	WDT_RPL_4_CYCLES,
	WDT_RPL_8_CYCLES,
	WDT_RPL_16_CYCLES,
	WDT_RPL_32_CYCLES,
	WDT_RPL_64_CYCLES,
	WDT_RPL_128_CYCLES,
	WDT_RPL_256_CYCLES
}WDT_RPL_E;

typedef enum
{
    WDG_USER0_OR_64K = 0x0U,    /*Time out of WDT_USER_TOP_INIT_0 or 64K Clocks*/
    WDG_USER1_OR_128K,          /*Time out of WDT_USER_TOP_INIT_1 or 128K Clocks*/
    WDG_USER2_OR_256K,           /*Time out of WDT_USER_TOP_INIT_2 or 256K Clocks*/
    WDG_USER3_OR_512K,           /*Time out of WDT_USER_TOP_INIT_3 or 512K Clocks*/
    WDG_USER4_OR_1M,             /*Time out of WDT_USER_TOP_INIT_4 or 1M Clocks*/
    WDG_USER5_OR_2M,             /*Time out of WDT_USER_TOP_INIT_5 or 2M Clocks*/
    WDG_USER6_OR_4M,             /*Time out of WDT_USER_TOP_INIT_6 or 4M Clocks*/
    WDG_USER7_OR_8M,             /*Time out of WDT_USER_TOP_INIT_7 or 8M Clocks*/
    WDG_USER8_OR_16M,            /*Time out of WDT_USER_TOP_INIT_8 or 16M Clocks*/
    WDG_USER9_OR_32M,            /*Time out of WDT_USER_TOP_INIT_9 or 32M Clocks*/
    WDG_USER10_OR_64M,           /*Time out of WDT_USER_TOP_INIT_10 or 64M Clocks*/
    WDG_USER11_OR_128M,          /*Time out of WDT_USER_TOP_INIT_11 or 128M Clocks*/
    WDG_USER12_OR_256M,          /*Time out of WDT_USER_TOP_INIT_12 or 256M Clocks*/
    WDG_USER13_OR_512M,          /*Time out of WDT_USER_TOP_INIT_13 or 512M Clocks*/
    WDG_USER14_OR_1G,            /*Time out of WDT_USER_TOP_INIT_14 or 1G Clocks*/
    WDG_USER15_OR_2G,            /*Time out of WDT_USER_TOP_INIT_15 or 2G Clocks*/
}Wdg_TimeOutType;

/********************************extern call function***************************************/
extern void irq_wdt(unsigned int reg_base);

void sw_core0_wdt_kick_dog(void);

#endif
